import Http from './http';

const http = new Http();

// 设置同步目录
export const setPathMacId = (data: any) => {
  return http.request('POST', '/bimfile/doc-sync/setUserSyncDir', data);
};

// 查询同步目录
export const getPathMacId = (data: any) => {
  return http.request('POST', '/bimfile/doc-sync/findUserSyncDir', data);
};

interface TaskProps {
  mid: string;
  mainId: number;
  busId: string;
  nodeId?: string;
  fileId?: string;
  syncType: number; // 同步类型 (1-下载 2-上传 3-更新 4-重命名 5-删除)
  downloadType: number; // 下载类型 (1-文件 2-目录 3-项目)(如果同步类型为1时不能为空)
}

// 创建任务批次
export const setNewSyncTask = (data: TaskProps) => {
  return http.request('POST', '/bimfile/doc-sync/newSyncTask', data);
};

// 查询日志
export const findLogs = (data: TaskProps) => {
  return http.request('POST', '/bimfile/doc-sync/findLogs', data);
};
// 查询未完成任务
export const findUnfinishedTasks = (data: TaskProps) => {
  return http.request('POST', '/bimfile/doc-sync/findUnfinishedTasks', data);
};

// 查询未完成任务
export const batchFailure = (data: TaskProps) => {
  return http.request('POST', '/bimfile/doc-sync/batchFailure', data);
};
